package com.kzd.gtgame.db

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey

@Entity(indices = [Index(value = ["game_id"], unique = true)])
class GameDownload {

    @PrimaryKey(autoGenerate = true)
    var id: Int = 0

    @ColumnInfo(name = "account")
    var account: Int = 0

    @ColumnInfo(name = "game_icon")
    var gameIcon: String = ""

    @ColumnInfo(name = "game_name")
    var gameName: String = ""

    @ColumnInfo(name = "game_id")
    var gameId: String = ""

    @ColumnInfo(name = "file_name")
    var fileName: String = ""

    @ColumnInfo(name = "file_size")
    var fileSize: Long = 0

    @ColumnInfo(name = "current_size")
    var currentSize: Long = 0

    @ColumnInfo(name = "progress")
    var progress: Int = 0

    @ColumnInfo(name = "down_status")
    var downStatus: Int = 0

    @ColumnInfo(name = "down_path")
    var downPath: String = ""

    @ColumnInfo(name = "local_path")
    var localPath: String = ""
}

data class Download(
    val action: Action = Action.ACTION_INSERT,
    val gameDownload: GameDownload? = null
) {
    enum class Action {
        ACTION_INSERT, ACTION_UPDATE, ACTION_DELETE, ACTION_CLEAR
    }
}

